import java.util.Arrays;
public class MiningNobel{
	public static int count(double[] a){
		//count quadruples that sum to 0
		Arrays.sort(a);
		int N = a.length;
		int cnt =0;
		for (int i=0; i<N; i++) {
			for (int j=i+1; j<N; j++) {
				for (int k=j+1; k<N; k++){
					if (BinarySearch.rank(-a[i]-a[j]-a[k], a)>k){
						cnt++;
					}			
				}
			}
		}
		return cnt;
	}
	
	//first argument is N (#oflines).
	//the method should be run as: java MiningNobel [number of lines] < [file-path]
	//we found the length of constant.csv with: cat constants.csv | wc -l - it is 353 BTW :)
	//ie. java MiningNobel 353 < constants.csv
	public static void main(String[] args) {
		double[] a = new double[Integer.parseInt(args[0])];  
		for (int i=0; i<a.length;i++) {
			String s = StdIn.readLine();	
			String[] ss = s.split(",");
			a[i] = Double.parseDouble(ss[1]);
		}
		System.out.println(count(a));
	}
}
